<template>
  <div class="bg-[#232324] h-[100%]" v-loading="loading">
    <el-collapse v-loading="loading" v-model="activeNames">
      <el-form label-width="100" :model="states" size="default">
        <el-collapse-item title="边框属性" name="border">
          <el-form-item label="边框颜色">
            <el-color-picker v-model="states.color" /> </el-form-item
          ><el-form-item label="边框颜色2">
            <el-color-picker v-model="states.color2" />
          </el-form-item>

          <el-form-item label="文字内容" v-if="!states.ifTitle">
            <el-input clearable v-model="states.text" class="!w-[180px]" />
          </el-form-item>
          <el-form-item label="文字横向偏移" v-if="!states.ifTitle">
            <el-input clearable v-model="states.x" class="!w-[180px]" />
          </el-form-item>
          <el-form-item label="文字纵向偏移" v-if="!states.ifTitle">
            <el-input clearable v-model="states.y" class="!w-[180px]" />
          </el-form-item>
          <el-form-item label="文字颜色" v-if="!states.ifTitle">
            <el-color-picker v-model="states.fontColor" />
          </el-form-item>
          <el-form-item label="文字大小" v-if="!states.ifTitle">
            <el-input-number v-model="states.fontSize" />
          </el-form-item>
        </el-collapse-item>
      </el-form>
    </el-collapse>
  </div>
</template>

<script setup>
import { computed, onMounted, ref } from "vue";
const loading = ref(true);
const activeNames = ref();
const props = defineProps({
  models: {
    type: Object,
    default: () => ({}),
  },
});
const emit = defineEmits(["update:models", "edit"]);

onMounted(() => {
  setTimeout(() => {
    loading.value = false;
  }, 200);
});

const states = computed({
  get: () => props.models,
  set: () => emit("update:models"),
});
const clicks = () => {
  emit("edit", "edit_");
};
</script>

<style scoped lang="scss">
:deep(.el-collapse-item__header) {
  padding-left: 10px !important;
}
</style>
